<!-- 编辑导航 -->
<template>
    <div class=''>
        <a-modal :title="title" :visible="visible" :width="600" @cancel="visible = false" :footer="null">
            <a-table ref="table" rowKey="menuId" :pagination="pagination" :columns="columns" :dataSource="data">
                <span slot="action" slot-scope="text, record">
                    <!-- {{ record }} -->
                    <a @click="handleAdd(record.menuId + '')">添加子菜单</a>
                    <a-divider type="vertical" />
                    <a @click="handleEdit(record)">编辑</a>
                    <a-divider type="vertical" />
                    <a @click="delById(record.menuId)">删除</a>
                </span>
            </a-table>
        </a-modal>
        <EditDetail ref="editDetail" />
    </div>
</template>

<script>
import EditDetail from '../editDetail'
export default {
    components: {
        EditDetail
    },
    data() {
        return {
            visible: false,
            title: '新增导航',
            type: 'add',
            pagination: false,
            data: [
                {
                    key: 1,
                    name: 'John Brown sr.',
                    age: 60,
                    address: 'New York No. 1 Lake Park',
                    children: [
                        {
                            key: 11,
                            name: 'John Brown',
                            age: 42,
                            address: 'New York No. 2 Lake Park',
                        },
                        {
                            key: 12,
                            name: 'John Brown jr.',
                            age: 30,
                            address: 'New York No. 3 Lake Park',
                            children: [
                                {
                                    key: 121,
                                    name: 'Jimmy Brown',
                                    age: 16,
                                    address: 'New York No. 3 Lake Park',
                                },
                            ],
                        },
                        {
                            key: 13,
                            name: 'Jim Green sr.',
                            age: 72,
                            address: 'London No. 1 Lake Park',
                            children: [
                                {
                                    key: 131,
                                    name: 'Jim Green',
                                    age: 42,
                                    address: 'London No. 2 Lake Park',
                                    children: [
                                        {
                                            key: 1311,
                                            name: 'Jim Green jr.',
                                            age: 25,
                                            address: 'London No. 3 Lake Park',
                                        },
                                        {
                                            key: 1312,
                                            name: 'Jimmy Green sr.',
                                            age: 18,
                                            address: 'London No. 4 Lake Park',
                                        },
                                    ],
                                },
                            ],
                        },
                    ],
                },
                {
                    key: 2,
                    name: 'Joe Black',
                    age: 32,
                    address: 'Sidney No. 1 Lake Park',
                },
            ],
            columns: [
                {
                    title: '菜单',
                    dataIndex: 'name',
                    key: 'name',
                },
                {
                    title: '操作',
                    key: 'address',
                    scopedSlots: { customRender: 'action' },
                },
            ]
        }
    },
    computed: {},
    watch: {},
    methods: {
        show(data) {
            let { title, type, obj } = data
            this.title = title
            this.type = type
            this.
                this.visible = true
        },
        handleAdd() {
            this.$refs.editDetail.show()
        },
        handleEdit() {
            this.$refs.editDetail.show()
        }
    },
    created() {

    },
    mounted() {

    },
}
</script>
<style scoped>
</style>